import React, {useState} from 'react'
import Select from 'react-select'

const CustomSelect = props => {
  const {value, setValue} = useState('')
  const {className, required, maxMenuHeight, options, name} = props

  const handleChange = value => {
    setValue(value)
  }
  return (
    <Select
      className={`input-dark-bg ${className} ${required ? 'is-invalid input-invalid' : ''}`}
      maxMenuHeight={maxMenuHeight}
      classNamePrefix="dark_select"
      value={value}
      options={options}
      onChange={handleChange}
      name={name}
    />
  )
}

export default CustomSelect
